<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../../include/admincontent_exam.jsp" %>
<% String basepaths = request.getContextPath(); %>
<div id="Content" style="min-height: 600px;min-width: 2080px">
  <%--  <div class="btnbar">
        <button type="button" class="list" id="bs_plan">笔试安排</button>
        <button type="button" class="import" id="bs_outplan">导出笔试安排</button>
        <button type="button" class="import" id="bs_outnum">导出准考证</button>
        <button type="button" class="import" id="bs_in">导入笔试成绩</button>
        <button type="button" class="list" id="bs_msg">发短信</button>
        <button type="button" class="list" id="do_nznext">进入下一步</button>
        <button type="button" class="back" onclick="javascript:history.go(-1);">返 回</button>
    </div>--%>

    <div class="toolbars" style="height:30px;white-space:nowrap;width:auto;margin-left: 10px;" totalwidth="314">
        <a id="bs_plan">
            <em class="ico16 sort_text_16"></em>
            <span class="menu_span" title="笔试安排">笔试安排</span>
        </a>
        <a id="btn_assignment" style="margin-left: 5px">
            <em class="ico16 grid_listview"></em>
            <span class="menu_span" title="一键分配">一键分配</span>
        </a>
        <a id="bs_outexaminfo" style="margin-left: 5px">
            <em  class="ico16 refresh2_16"></em>
            <span  class="menu_span" title="导入/导出考试信息">导入/导出考试信息</span>
        </a>
        <a id="bs_msg" style="margin-left: 5px">
            <em  class="ico16 common_language_16"></em>
            <span  class="menu_span" title="发短信">发短信</span>
        </a>
        <a id="dosz_tjgwNew" style="margin-left: 5px">
            <em  class="ico16 sort_ch_16"></em>
            <span  class="menu_span" title="推荐其他岗位"  pid="${pid}" fid="${fid}" deptcode="${deptcode}">推荐其他岗位</span>
        </a>
        <a id="gxpublisharrange" style="margin-left: 5px">
            <em class="ico16 plan_16"></em>
            <span class="menu_span" title="公布/屏蔽安排" fid="${fid}" deptcode="${deptcode}">公布/屏蔽安排</span>
        </a>
        <a id="nzpublishresult" style="margin-left: 5px" fid="${fid}" deptcode="${deptcode}">
            <em class="ico16 grid_listview"></em>
            <span class="menu_span" title="公布/屏蔽结果">公布/屏蔽结果</span>
        </a>
        <a id="do_nznext" style="margin-left: 5px">
            <em  class="ico16 more_blue"></em>
            <span  class="menu_span" title="进入下一步">进入下一步</span>
        </a>
        <a id="resume_down_zip" style="margin-left: 5px">
            <em  class="ico16 download_online_16"></em>
            <span  class="menu_span" title="下载简历">下载简历</span>
        </a>
        <a id="send_news" style="margin-left: 5px">
            <em  class="ico16 info_16"></em>
            <span  class="menu_span" title="消息通知">消息通知</span>
        </a>
    </div>

    <!-- 笔试安排 --><%--class="condition_cont"--%>
      <div id="planpanel"  style="display:none;">
          <form id="thisform1" method="post" action="/Do/BS/PlanAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}">
              <table class="treeTable searchform">
                  <thead>
                  <tr>
                      <td>考试日期:</td>
                      <td width="220">
                          <div><input type="text" id="bsdate" name="bsdate" class="select"   datatype="*" nullmsg="请填写考试时间!" />

                          </div>

                      </td>
                      <td style="text-align:left">双击日期可进行编辑!</td>
                      <td></td>
                  </tr>
                  <tr>
                      <td>考试时段:</td>
                      <td width="220">
                          <div><input type="text" id="bstimes" name="bstimes" class="select" datatype="*" nullmsg="请填写考试时段!" />

                          </div>
                      </td>
                      <td style="text-align:left">双击时间可进行编辑!</td>
                      <td ></td>
                  </tr>
                  <tr>
                      <td width="90">选择考场:</td>
                      <td width="440">
                          <div><select name="room" id="bsRoom" datatype="*" nullmsg="请选择考场">${room}</select></div>
                      </td>
                      <td width="400" style="text-align:left" colspan="2">如果没有您要选择的考场，请先到 <a href="/Do/BS/room">考场管理</a> 中新增考场，<br/>或在<a href="/Do/BS/exam">考试记录</a> 中删除考试。</td>

                  </tr>
                  <tr>
                      <td width="80">确认截止时间:</td>
                      <td >
                          <%--<div><input type="text" id="endtime" name="endtime" class="select" onFocus="blur()" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})"/></div>--%>
                          <div><input type="text" id="endtime" name="endtime" class="select" datatype="*"/></div>

                      </td>
                      <td style="text-align:left">不设定默认为笔试前2天!</td>
                      <td></td>

                  </tr>
                  <tr>
                      <td >备注:</td>
                      <td>
                          <div><input type="text" name="remark" style="height: 50px"/></div>
                      </td>
                      <td style="text-align:left">用于准考证备注栏</td>
                      <td></td>
                  </tr>
                  <tr>
                      <td>注意事项:</td>
                      <td>
                          <div id="div_bszysx">
                              <%--                            <textarea name="bszysx" id="bszysx" style="width:99%;height:150px;" > ${bszysx}</textarea> --%>
                              <textarea name="bszysx" id="bszysx" style="height:auto;overflow-x:visible;overflow-y:visible;">${bszysx}</textarea>
                          </div>
                      </td>
                      <%--                    <td style="text-align:left">笔试注意事项,如无注意事项<a href="javascript:clearZysx()">清除</a>内容即可</td>--%>
                      <td style="text-align:left">笔试注意事项</td>
                      <td></td>
                  </tr>
                  <tr>
                      <td height="50"></td>
                      <td colspan="3">
                          <button type="submit" class="op">保存笔试安排</button>

                      </td>
                  </tr>
                  </thead>
              </table>
              <div id="bsusers"></div>
          </form>
      </div>

    <!-- 笔试通知 -->
    <div id="msgpanel" class="condition_cont">
        <form id="thisform2" method="post" action="/Do/BS/MsgAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}">
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="60">短信模版：</td>
                    <td width="500">
                        <div><select id="dxmb" datatype="*" nullmsg="短信模版不能为空！">${dxmb}</select></div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td>短信内容：</td>
                    <td>
                        <div><textarea name="dxnr" datatype="*" nullmsg="短信内容不能为空！"></textarea></div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <button type="submit" class="save">提 交</button>
                    </td>
                    <td></td>
                </tr>
                </thead>
            </table>
            <div id="msgusers"></div>
        </form>
    </div>

      <!-- 消息通知 -->
      <div id="infospanel"  class="condition_cont">
          <form id="infosform" method="post" action="/Do/SendInfos/SendInfosAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}">
              <table class="treeTable searchform">
                  <thead>
                  <tr>
                      <td width="100">消息内容:</td>
                      <td width="500">
                          <div><textarea name="infoContent" datatype="*" nullmsg="消息内容不能为空！"></textarea></div>
                      </td>
                      <td></td>
                  </tr>
                  <tr>
                      <td></td>
                      <td>
                          <button type="submit" class="op">发送消息通知</button>
                      </td>
                      <td></td>
                  </tr>
                  </thead>
              </table>
              <div id="infosuers"></div>
              <div id="infosuerCardnos"></div>
          </form>
      </div>

    <!-- 筛选条件 -->
      <div id="searchbox">
          <form id="sform">
              <input type="hidden" name="proid" value="${pid}"/>
              <input type="hidden" name="path" value="${fid}"/>
              <input type="hidden" name="rcount" id="checkrount" value=""/>
              <input type="hidden" name="checkIds" id="checkIds" value=""/>
              <table class="treeTable searchform">
                  <thead>
                  <tr>
                      <td width="60">应聘岗位:</td>
                      <td >
                          <div>
                              <%-- <input type="text" name="jname"/>--%>

                              <select name="jname">
                                  <option value="">请选择</option>
                                  <c:forEach var="projectinfojobs" items="${jobs}" varStatus="item" >
                                      <c:choose>
                                          <c:when test="${projectinfojobs!=null}">
                                              <option value="${projectinfojobs.jobname}">${projectinfojobs.jobname}</option>
                                          </c:when>

                                      </c:choose>
                                  </c:forEach>
                              </select>
                          </div>
                      </td>
                      <td width="60">姓名:</td>
                      <td>
                          <div><input type="text" name="name"/></div>
                      </td>
                      <td width="60">身份证号:</td>
                      <td>
                          <div><input type="text" name="cardno"/></div>
                      </td>

                      <td width="60">所学专业:</td>
                      <td >
                          <div>
                              <input type="text" name="majorname"/>
                          </div>
                      </td>
                      <td width="60">毕业院校:</td>
                      <td >
                          <div>
                              <input type="text" name="university"/>
                          </div>
                      </td>
                  </tr>
                  <tr>

                      <td>联系电话:</td>
                      <td>
                          <div>
                              <input type="text" name="tel"/>
                          </div>
                      </td>
                      <td>最高学历:</td>
                      <td >
                          <div><select name="education">
                              <option value="-1">不限</option>
                              ${education}</select></div>
                      </td>
                      <td >确认状态:</td>
                      <td>
                          <div>
                              <select name="bsconfirm">
                                  <option value="-1">全部</option>
                                  <option value="参加">参加</option>
                                  <option value="不参加">不参加</option>
                                  <option value="否">未确认</option>
                              </select>
                          </div>
                      </td>
                      <td>短信通知:</td>
                      <td >
                          <div>
                              <select name="notice">
                                  <option value="-1">全部</option>
                                  <option value="0">已发通知</option>
                                  <option value="1">未发通知</option>
                              </select>
                          </div>
                      </td>
                      <td>笔试结果:</td>
                      <td >
                          <div>
                              <select name="bsresult">
                                  <option value="">全部</option>
                                  <option value="不通过">不通过</option>
                                  <option value="已通过">已通过</option>
                              </select>
                          </div>
                      </td>
                  </tr>
                  <tr class="moretj">
                      <td width="60">民族:</td>
                      <td width="150">
                          <div><select name="mzcode">
                              <option value="">不限</option>
                              ${minzu}</select></div>
                      </td>
                      <td width="60">政治面貌:</td>
                      <td width="150">
                          <div><select name="zzmmcode">
                              <option value="">不限</option>
                              ${zzmm}</select></div>
                      </td>
                      <td width="60" style="text-align:right;">年龄:</td>
                      <td width="160">
                          <div><input type="text" name="agefrom" style="max-width: 40%"/>至<input type="text" name="ageto" style="max-width: 40%"/></div>
                      </td>
                      <%-- <td width="16" style="text-align:center;">至</td>
                       <td width="60">
                           <div><input type="text" name="ageto"/></div>
                       </td>--%>
                      <td width="60" style="text-align:right;">身高:</td>
                      <td width="160">
                          <div><input type="text" name="heightfrom" style="max-width: 40%"/>至<input type="text" name="heightto" style="max-width: 40%"/></div>
                      </td>
                      <%--  <td width="36" style="text-align:center;">至</td>
                        <td width="50">
                            <div></div>
                        </td>--%>
                      <td width="60">性别:</td>
                      <td>
                          <div>
                              <select name="sex">
                                  <option value="">不限</option>
                                  <option value="男">男</option>
                                  <option value="女">女</option>
                              </select>
                          </div>
                      </td>
                  </tr>
                  <tr class="moretj">


                      <td>户口所在地:</td>
                      <td>
                          <div><input type="text" name="hukouaddress"/></div>
                      </td>
                      <td>现居住地:</td>
                      <td>
                          <div><input type="text" name="nowaddress"/></div>
                      </td>
                      <td>是否放弃:</td>
                      <td>
                          <div>
                              <select name="fqstate">
                                  <option value="">全部</option>
                                  <option value="未放弃" selected>未放弃</option>
                                  <option value="已放弃">已放弃</option>
                              </select>
                          </div>
                      </td>
                      <td  style="text-align:right;">工作年限:</td>
                      <td >
                          <div><input type="text" name="workyearfrom" style="max-width: 40%"/>至<input type="text" name="workyearto" style="max-width: 40%"/></div>
                      </td>
                      <td>职业资格证:</td>
                      <td>
                          <div><select name="qllevelpid" id="s_jndjp">
                              <option value="">不限</option>
                              ${jndj}</select></div>
                      </td>

                  </tr>
                  <tr class="moretj">
                      <td>简历状态:</td>
                      <td >
                          <div> <select name="state">
                              <option value="">不限</option>
                              <option value="未处理">未处理</option>
                              <option value="已通过">已通过</option>
                              <option value="未通过">未通过</option>
                          </select></div>
                      </td>
                      <td>意向地点:</td>
                      <td >
                          <div>
                              <input type="text" name="presentsalaryamount"/>
                          </div>
                      </td>
                      <td colspan="6"></td>
                  </tr>
                  <tr>
                      <td colspan="2">
                          <%--                        <div style="padding-top: 8px;">
                                                      <button id="searchbtn" type="button" class="search"></button>
                                                      <button id="clearbtn" type="reset" class="del" title="清除" style="flex: 1;margin-left: 5px;"></button>
                                                  </div>--%>
                          <div class="toolbars">
                              <a id="searchbtn">
                                  <em class="ico16 search_16"></em>
                                  <span >查询</span>
                              </a>
                              <a id="clearbtn">
                                  <em class="ico16 refresh_16"></em>
                                  <span>清除</span>
                              </a>
                          </div>
                      </td>
                      <td colspan="8">
                          <%--                        <button id="showhidebtn" type="button" class="moretjbtn0" onclick="moreparam()"
                                                          title="高级查询"></button>--%>
                          <div class="toolbars">
                              <a onclick="moreparam()">
                                  <em class="ico16 search_disable_16"></em>
                                  <span >高级查询</span>
                              </a>
                          </div>
                      </td>
                  </tr>
                  </thead>
              </table>
          </form>
      </div>
    <%--<div id="searchbox">
        <form id="sform">
            <input type="hidden" name="pid" value="${pid}"/>
            <input type="hidden" name="deptcode" value="${deptcode}"/>
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="60">员工号:</td>
                    <td width="120">
                        <div><input type="text" name="code"/></div>
                    </td>
                    <td width="30">姓名:</td>
                    <td width="120">
                        <div><input type="text" name="name"/></div>
                    </td>
                    <td width="60">性别:</td>
                    <td width="120">
                        <div>
                            <select name="sex">
                                <option value="">全部</option>
                                <option value="男">男</option>
                                <option value="女">女</option>
                            </select>
                        </div>
                    </td>
                    <td width="60">笔试结果:</td>
                    <td width="120">
                        <div>
                            <select name="bsresult">
                                <option value="">全部</option>
                                <option value="未通过">未通过</option>
                                <option value="通过">通过</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>政治面貌:</td>
                    <td>
                        <div><input type="text" name="zzmm"/></div>
                    </td>
                    <td>学历:</td>
                    <td>
                        <div><input type="text" name="education"/></div>
                    </td>
                    <td>短信通知:</td>
                    <td>
                        <div>
                            <select name="notice">
                                <option value="-1">全部</option>
                                <option value="0">已发通知</option>
                                <option value="1">未发通知</option>
                            </select>
                        </div>
                    </td>
                    <td>是否放弃:</td>
                    <td>
                        <div>
                            <select name="fqstate">
                                <option value="">全部</option>
                                <option value="未放弃" selected>未放弃</option>
                                <option value="已放弃">已放弃</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="8">
                        &lt;%&ndash;<button id="searchbtn" type="button" class="search"></button>&ndash;%&gt;
                        <div class="toolbars" style="text-align: left;padding-left: 40px">
                            <a id="searchbtn">
                                <em class="ico16 search_16"></em>
                                <span >查询</span>
                            </a>
                            <a id="clearbtn">
                                <em class="ico16 refresh_16"></em>
                                <span>清除</span>
                            </a>
                        </div>
                    </td>
                </tr>
                </thead>
            </table>
        </form>
    </div>--%>

 <%--   <table class="treeTable" id="tablelist">
        <thead>
        <tr>
            <td width="20"><input type="checkbox" class="allcheckbox" title="选择全部/取消全选"/></td>
            <td width="40">员工号</td>
            <td width="70">姓名</td>
            <td width="70">学历</td>
            <td width="70">联系方式</td>
            <td width="70">准考证号</td>
            <td width="40">座位号</td>
            <td>笔试安排</td>
            <td width="70">综合素质</td>
            <td width="70">个性测评</td>
            <td width="70">专业测评</td>
            <td width="70">本轮成绩</td>
            <td width="50">短信通知</td>
            <td width="45"></td>
        </tr>
        </thead>
        <tbody id="result"></tbody>
    </table>
    <div id="page"></div>--%>
      <table class="layui-hide" id="tablelistNzExam" lay-filter="listTables"></table>
</div>
<script type="text/javascript">
    $("#searchbox").width($(window).width()-10);

    var laydate;
    var editor;
    var form;
    var ptypes = "NZExam";

    layui.use('form', function(){
        form = layui.form;
        //各种基于事件的操作，下面会有进一步介绍
        form.render();
    });

    layui.use('laydate', function () {
        laydate = layui.laydate;

    });
    laydate.render({
        elem: '#bsdate'
        //,type: 'date' //默认，可不填
        ,value:new Date()
        ,theme: 'grid'
    });
    laydate.render({
        elem: '#bstimes'
        ,type: 'time'
        ,range: '~' //或 range: '~' 来自定义分割字符
        ,value:'09:00:00 ~ 00:00:00'
        ,theme: 'grid'
    });
    laydate.render({
        elem: '#endtime'
        ,type: 'datetime'
        ,format:"yyyy-MM-dd HH:mm"
        ,theme: 'grid'
    });

    $('#clearbtn').on('click',function () {
        document.getElementById("sform").reset();
    });
    $('#bstimes').focus(function () {
        var bsdate=$('#bsdate').val();
        if(!!!bsdate){
            layer.msg('请先选择考试日期!',{icon:7,time:2000});
        }
    });

    $('#bstimes').click(function () {
        var bsdate=$('#bsdate').val();
        var bstimes=$('#bstimes').val();
        if(!!!bsdate){
            layer.msg('请先选择考试日期!',{icon:7,time:2000});
            $('#bsdate').focus();
        }
        if(!!!bstimes||bstimes=='09:00:00 ~ 00:00:00'){
            layer.msg('请先选择考试时段!',{icon:7,time:2000});
            $('#bstimes').focus();
        }else {
            $.ajax({
                url:"/Do/BS/getCanUseRoom",
                type:"POST",
                data:{date: bsdate,times:bstimes},
                dataType:"json",
                success:function(data){
                    $('#bsRoom').empty();
                    $(data).each(function (index,room) {
                        $('#bsRoom').append('<option value="'+room.id+'">'+room.name+'['+room.kbrs+']'+'</option>');
                    });
                    // console.log(data);
                }
            });
        }
    });
    $('#bsRoom').click(function () {
        var bsdate=$('#bsdate').val();
        var bstimes=$('#bstimes').val();
        if(!!!bsdate){
            layer.msg('请先选择考试日期!',{icon:7,time:2000});
            $('#bsdate').focus();
        }
        if(!!!bstimes||bstimes=='09:00:00 ~ 00:00:00'){
            layer.msg('请先选择考试时段!',{icon:7,time:2000});
            $('#bstimes').focus();
        }

    });

    var selectDataTemp = [];
    function getTableChecks(){
        var selectData = layui.table.checkStatus('listTables').data;

        if(selectDataTemp.length > 0){
            for(var i=0;i<selectDataTemp.length;i++){
                $('#bsusers input').each(function () {
                    if ($(this).val() == selectDataTemp[i].id_cb.replace('cb_', ''))
                        $(this).remove();
                });
                $('#msgusers input').each(function () {
                    if ($(this).val() == selectDataTemp[i].id_cb.replace('cb_', ''))
                        $(this).remove();
                });
                $('#infosuers input').each(function () {
                    if ($(this).val() == selectDataTemp[i].id_cb.replace('cb_', ''))
                        $(this).remove();
                });
                $('#infosuerCardnos input').each(function () {
                    if ($(this).val() == selectDataTemp[i].CARDNO)
                        $(this).remove();
                });
            }
        }
        if(selectData.length == 0){
            selectDataTemp = selectData;
        }else{
            for(var i=0;i<selectData.length;i++){
                $('#bsusers').append('<input type="hidden" name="uid" value="' + selectData[i].id_cb.replace('cb_', '') + '"/>');
                $('#msgusers').append('<input type="hidden" name="uid" value="' + selectData[i].id_cb.replace('cb_', '')  + '"/>');
                $('#infosuers').append('<input type="hidden" name="id" value="' + selectData[i].id_cb.replace('cb_', '') + '"/>');
                $('#infosuerCardnos').append('<input type="hidden" name="cardno" value="' + selectData[i].CARDNO + '"/>');
            }
            selectDataTemp = selectData;
        }
    }
        //笔试安排
        $('#bs_plan').click(function () {
            getTableChecks();
            var title="笔试安排";
            $('#planpanel').hide();
            var bsPlans=layer.open({
                type:1
                ,title:title
                ,content: $('#planpanel')
                ,skin: 'flowForm-lys'
                ,area:  ['900px','550px']
                ,cancel: function(){
                    $('#planpanel').hide();
                }
            });
        });
        //一键安排
        $('#btn_assignment').click(function () {
            getTableChecks();
            parent.layer.open({
                type: 2,
                title: "一键安排",
                shade: 0.5,
                area: ['80%', '600px'],
                content: encodeURI('/Do/BS/assignment?pid=${pid}&fid=${fid}&deptcode=${deptcode}'),
                end:function () {
                    location.reload();
                }
            });
        });

        //导入/导出考试信息
        $('#bs_outexaminfo').click(function () {
            var uid = '';
            var uidCount = 0;
            getTableChecks();
            $('#bsusers input').each(function () {
                uid += '&uid=' + $(this).val();
                uidCount++;
            });
            openpLayerClo('导出考试信息', '/ExcelDown/DownExamInfo?pid=${pid}&fid=${fid}&deptcode=${deptcode}&uidCount='+uidCount+'&'+ uid, '50%', '50%');
        });

        //消息通知
        $('#send_news').on('click',function () {
            getTableChecks();

            $('#infospanel').slideToggle(300);
            $(this).toggleClass('cur').blur().siblings().removeClass('cur');
            if (!$('#msgpanel').is(":hidden")) {
                $('#msgpanel').slideToggle(300);
            }
        });

       //笔试通知
       $('#bs_msg').click(function () {
           getTableChecks();
           $('#msgpanel').slideToggle(300);
           $(this).toggleClass('cur').blur().siblings().removeClass('cur');
           if (!$('#infospanel').is(":hidden")) {
               $('#infospanel').slideToggle(300);
           }
       });

       $('#do_nznext').click(function () {
           layer.confirm('只有笔试通过的人员才能进入下一步。<br>确定要执行吗？', {
               btn: ['是', '否']
           }, function () {
               toNextFlowNew('/Do/NZExam/NextAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}');
               parent.layer.closeAll();
           }, function () {
               parent.layer.closeAll();
           });
       });

    getMsg();
    getExam();
    $('select[name=room]').change(function () {
        getExam();
    });
    function getExam() {
        var url = '/Do/BS/getrexams?id=' + $('select[name=room]').val();
        getAjax(url, null, function (data) {
            $('select[name=exam]').html(data);
        });
    }
    $('#dxmb').change(function () {
        getMsg();
    });
    function getMsg() {
        getAjax('/Do/BS/getMsg?code=' + $('#dxmb').val(), null, function (data) {
            $('textarea[name=dxnr]').val(data);
        });
    }

   layui.config({
       base: '<%=basepaths%>/resources/js/plugins/ext/',   // 模块目录
       version: 'v1.5.10' // 插件版本号
   }).extend({
       soulTable: 'soulTable',// 模块别名
       tableChild: 'tableChild',
       tableMerge: 'tableMerge',
       tableFilter: 'tableFilter',
       // excel: 'excel',
   });

    var NzExamsTable;
    var sdat;
   layui.use(['table','soulTable','tableChild','tableMerge','tableFilter'], function(){
       var soulTable = layui.soulTable,
           tableChild = layui.tableChild,
           tableMerge = layui.tableMerge,
           tableFilter = layui.tableFilter,
           $ = layui.$;

       NzExamsTable = layui.table;
       sdat = '${path}/Do/NZExam/getNZExamListLayuiJson?flowid=${fid}&'+$('#sform').serialize();

       NzExamsTable.render({
           id:'listTables'
           ,elem: '#tablelistNzExam'
           ,url: sdat
           ,title:'用户数据表'
           , height: 'full'
           ,cellMinWidth: 40 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
           ,contextmenu: {
               // 表格内容右键菜单配置
               body: [
                   {
                       name: '情况说明', // 显示的菜单名
                       click: function(obj) { //点击事件
                           //   console.log(obj.row) // 当前行数据
                           var tcid = obj.row.id_cb;
                           var rmarkid = obj.cell[0].parentElement.children[3].innerText;
                           var cardno = obj.row.CARDNO;
                           var rname = obj.row.NAME;
                           parent.layer.prompt({title: '请填写姓名:'+rname+' 身份证:'+cardno+' 个人情况说明，并确认', formType: 2}, function(text, index){
                               parent.layer.close(index);
                               var cid=tcid.replace('cb_','');
                               $.post("/SaveUserRemark"
                                   ,{id:rmarkid,pid:"${pid}",fid:"${fid}",deptcode:"${deptcode}",rid:cid,content:text,rname:rname,cardno:cardno}
                                   ,function (result) {
                                       if (result.state) {
                                           parent.layer.msg(result.message,{icon:1});
                                           tableRenders();
                                       }
                                       else {
                                           parent.layer.msg(result.message,{icon:2});
                                       }
                                   }
                                   ,"json");
                           });
                       }
                   }
                   ,{
                       name: "查看个人简历",// 显示的菜单名
                       click: function(obj) { //点击事件
                           var url = obj.row.ContextPath;
                           if(!!url){
                               window.open(url);
                           }
                       }
                   }
                   ,{
                       name: "刷新列表",// 显示的菜单名
                       click: function(obj) { //点击事件
                           tableRenders();
                       }
                   }
               ]
           }
           ,cols: [[
               {type:'checkbox',fixed:'center'}
               ,{field:'id', title: '序号', fixed:'center',sort: true,minWidth:80}
               ,{field:'NAME',title: '姓名', fixed:'left',sort: true,minWidth:100,templet: function(d){
                       if(d.cardcount>1){
                           return '<a target="_blank" href="' + d.ContextPath + '">' +d.NAME+
                               '</a>&nbsp;<span class="layui-badge">'+d.cardcount+'</span>';
                       }else{
                           return '<a target="_blank" href="' + d.ContextPath + '">' +d.NAME;
                       }
                   }}
               ,{field:'MID',  title: '', fixed:'center', sort: true,hide:true}
               //,{field:'CARDNO',title: '身份证号', fixed:'center',minWidth:160}
               ,{field:'JOBNUMBER',title: '工号', fixed:'center',minWidth:80}
               ,{field:'EDUCATIONNAME', title: '学历', fixed:'center', sort: true,minWidth:110}
               ,{field:'JNAME', title: '应聘岗位', fixed:'center', sort: true,minWidth:130}
               ,{field:'TEL',  title: '联系方式', fixed:'center',minWidth:120}
               ,{field:'TICKETNUM', title: '准考证号', fixed:'center', sort: true,minWidth:100}
               ,{field:'SEATNUM', title: '座位号', fixed:'center', sort: true,minWidth:90}
               ,{field:'KCNAME', title: '笔试安排', fixed:'center', sort: true,minWidth:110}
               ,{field:'ZHSZPOINT', title: 'A能力测验结果', fixed:'center', sort: true,minWidth:120}
               ,{field:'GXCPPOINT', title: 'B个性匹配度', fixed:'center', sort: true,minWidth:110}
               ,{field:'ZYCPPOINT', title: '测评总分', fixed:'center', sort: true,minWidth:90}
               ,{field:'RESULT', title: '测评总体结果', fixed:'center', sort: true,minWidth:100}
               ,{field:'NOTICE', title: '短信通知', fixed:'center', sort: true,minWidth:80}
               ,{field:'BSREMARK', title: '备注', fixed:'center', sort: true,minWidth:110}
               ,{field:'STATEa', title: '个人情况', fixed:'center', sort: true,minWidth:150,templet: function(d){
                       if(d.STATEb == "未公布")
                           return  '<input type="hidden" value="'+d.MID+'">'+d.MCONTENT;
                       else
                           return '<input type="hidden" value="'+d.MID+'">'+'最近登录：'+ d.LOGINTIME+'<br/>个人情况：'+d.MCONTENT;
                   }}
               ,{field:'arrange', title: '公布安排', fixed:'center', sort: true,minWidth:110,templet: function(d){
                       if(!d.arrange || d.arrange === "未公布")
                           return '<span class="layui-badge layui-bg-orange">未公布</span>';
                       else
                           return '<span class="layui-badge layui-bg-green">'+d.arrange+'</span>';
                   }}
               ,{field:'STATEb', title: '公布结果', fixed:'center', sort: true,minWidth:110,templet: function(d){
                       if(d.STATEb == "未公布")
                           return '<span class="layui-badge layui-bg-orange">'+d.STATEb+'</span>';
                       else
                           return '<span class="layui-badge layui-bg-green">'+d.STATEb+'</span>';
                   }}
               ,{field:'STATEc',  title: '', fixed:'center', sort: true,minWidth:80,templet: function(d){
                       switch(d.STATEc){
                           case "已放弃" :
                               return '<span class="yfq">'+d.STATEc+'</span>';
                               break;
                           case "已推荐" :
                               return '<span class="ytj" title="'+d.NJNAME+'">'+d.STATEc+'</span>';
                               break;
                           case "未完成" :
                               return '<span class="layui-badge layui-bg-orange">'+d.STATEc+'</span>';
                               break;
                           case "已完成" :
                               return '<span class="layui-badge layui-bg-green">'+d.STATEc+'</span>';
                               break;
                           case "不通过" :
                               return '<span class="yfq">'+d.STATEc+'</span>';
                               break;
                           default: '<span></span>'; break;
                       }}}
           ]]
           ,page: true
           , done: function () {
               soulTable.render(this);
           }
       });

       $("#searchbtn").on('click', () => {
           tableRenders();
       });
   });

   function tableRenders() {
       sdat = '${path}/Do/NZExam/getNZExamListLayuiJson?flowid=${fid}&'+$('#sform').serialize();
       //执行重载
       NzExamsTable.reload('listTables', {
           url: sdat
           ,method: 'get'
           ,page:  {
               curr: 1 //重新从第 1 页开始
           }
           ,where: {
           }
       }, 'data');
   }

</script>
</body>
</html>